<script setup lang="ts">
import CommonConfig from "./CommonConfig.vue";
import { type FormDesignerComponents } from "../FormComponentMixin";
const config = defineModel<FormDesignerComponents>("config");
const min = ref(0);
const max = ref(65535);

onMounted(() => {
  if (config.value.props.min) {
    min.value = parseInt(config.value.props.min);
  }
  if (config.value.props.max) {
    max.value = parseInt(config.value.props.max);
  }
});
</script>

<template>
  <CommonConfig v-model:config="config" />
  <el-form-item label="提示文字">
    <el-input v-model="config.props.placeholder" placeholder="输入提示" />
  </el-form-item>
  <el-form-item label="输入范围">
    <el-input-number v-model="min" placeholder="最小值" />
    <el-input-number v-model="max" placeholder="最大值" />
  </el-form-item>
  <el-form-item label="隐藏名称">
    <el-switch v-model="config.props.hideLabel" />
  </el-form-item>
  <el-form-item label="是否必填">
    <el-switch v-model="config.props.required" />
  </el-form-item>
</template>

<style lang="scss" scoped></style>
